package com.kinyx.framework.reflect;

import org.junit.Assert;
import org.junit.Test;

import com.kinyx.framework.reflect.ClassUtils_Tester.A;
import com.kinyx.framework.reflect.ClassUtils_Tester.B;
import com.kinyx.framework.reflect.ClassUtils_Tester.C;
import com.kinyx.framework.reflect.ClassUtils_Tester.D;
import com.kinyx.framework.reflect.ClassUtils_Tester.E;
import com.kinyx.framework.reflect.ClassUtils_Tester.F;
import com.kinyx.framework.reflect.ClassUtils_Tester.G;
import com.kinyx.framework.reflect.ClassUtils_Tester.H;
import com.kinyx.framework.reflect.ClassUtils_Tester.HH;
import com.kinyx.framework.reflect.ClassUtils_Tester.I;
import com.kinyx.framework.reflect.ClassUtils_Tester.X;
import com.kinyx.framework.reflect.ClassUtils_Tester.Y;
import com.kinyx.framework.reflect.ClassUtils_Tester.Z;

public class KClassUtils_Tester_checkImplements {

	@Test(expected = NullPointerException.class)
	public void test1() {
		Assert.assertFalse(KClassUtils.checkImplements(null, I.class));
	}

	@Test(expected = IllegalArgumentException.class)
	public void test2() {
		Assert.assertFalse(KClassUtils.checkImplements(null, A.class));
	}

	@Test(expected = NullPointerException.class)
	public void test3() {
		Assert.assertFalse(KClassUtils.checkImplements(A.class, null));
	}

	@Test
	public void test4() {
		Assert.assertTrue(KClassUtils.checkImplements(A.class, I.class));// A implements I
		Assert.assertTrue(KClassUtils.checkImplements(B.class, I.class));// B extends A -> A implements I
		Assert.assertTrue(KClassUtils.checkImplements(C.class, I.class));// C extends B -> B extends A -> A implements I
		Assert.assertTrue(KClassUtils.checkImplements(D.class, I.class));// D extends C ->  C extends B -> B extends A -> A implements I

		Assert.assertTrue(KClassUtils.checkImplements(X.class, I.class));// X extends I
		Assert.assertTrue(KClassUtils.checkImplements(E.class, I.class));// E implements X -> X extends I

		Assert.assertTrue(KClassUtils.checkImplements(Y.class, I.class));// Y extends X -> X extends I
		Assert.assertTrue(KClassUtils.checkImplements(F.class, I.class));// F implements Y -> Y extends X -> X extends I

		Assert.assertTrue(KClassUtils.checkImplements(Z.class, I.class));// Z extends Y -> Y extends X -> X extends I
		Assert.assertTrue(KClassUtils.checkImplements(G.class, I.class));// G implements Z -> Z extends Y -> Y extends X -> X extends I
		Assert.assertTrue(KClassUtils.checkImplements(H.class, I.class));// H extends G -> G implements Z -> Z extends Y -> Y extends X -> X extends I
		Assert.assertTrue(KClassUtils.checkImplements(HH.class, I.class));// HH extends H -> H extends G -> G implements Z -> Z extends Y -> Y extends X -> X extends I
	}

}
